package co.edu.javeriana.touresbalon.oms.webservices;

import co.edu.javeriana.touresbalon.b2c.entities.Producto;
import co.edu.javeriana.touresbalon.oms.entities.Orders;
import co.edu.javeriana.touresbalon.oms.services.OrdersBeanLocal;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/**
 *
 * @author ada
 */
@WebService(targetNamespace = "http://TouresBalonOMS/WebServices", portName="OrdersService", serviceName = "OrdersEndpointService")
@Stateless()
public class OrdersEndpointService {
    @EJB
    private OrdersBeanLocal ordersBean;    

    @WebMethod(operationName = "updateOrderFromProcess")
    //@Oneway
    public void updateOrderFromProcess(@WebParam(name = "comments") String comments, @WebParam(name = "refreshDate") Date refreshDate, @WebParam(name = "status") String status, @WebParam(name = "processStatus") String processStatus, @WebParam(name = "orderId") String orderId) {
        ordersBean.updateOrderFromProcess(comments, refreshDate, status, processStatus, orderId);
    }

    @WebMethod(operationName = "createOrderFromB2C")
    @Oneway
    public void createOrderFromB2C(@WebParam(name = "newOrder") Orders newOrder, @WebParam(name = "newProduct") Producto newProduct) {
        ordersBean.createOrderFromB2C(newOrder, newProduct);
    }

    @WebMethod(operationName = "findOrdersByCustomer")
    public List<Orders> findOrdersByCustomer(@WebParam(name = "idCustomer") String idCustomer) {
        return ordersBean.findOrdersByCustomer(idCustomer);
    }    
}
